package com.zhangyu.shadow.repair.delegate.irregular;

import com.alibaba.fastjson.TypeReference;

import java.util.ArrayList;

import st.lib.base.ui.recycler.ObjConverter;

/**
 * @author zhangyu
 * @date 2018/12/3
 */

public class IrregularBusDataConvert {

    public ArrayList<BusCountBean> convertBusCount(String response) {
        ArrayList<BusCountBean> list = new ObjConverter<ArrayList<BusCountBean>>().convert(response
                , new TypeReference<ArrayList<BusCountBean>>() {
                });
        if (list != null) {
            for (BusCountBean bean : list) {
                switch (bean.getOperateType()) {
                    case 0:
                        bean.setName("待交车");
                        break;
                    case 1:
                        bean.setName("小修异常");
                        break;
                    case 2:
                        bean.setName("保养异常");
                        break;
                }
            }
            list.add(new BusCountBean(-1, 0, "历史"));
        }

        return list;
    }
}
